using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SoundManager : MonoBehaviour
{
    private AudioSource[] audioSource;

    [Header("Background Sound")]
    [SerializeField] private AudioClip BGM;

    [Header("Effect Sound")]
    [SerializeField] private AudioClip[] sounds;

    void Start()
    {
        audioSource = GetComponents<AudioSource>();
        audioSource[0].loop = true;
        audioSource[0].clip = BGM;
        audioSource[0].Play();
        audioSource[0].volume = float.Parse(Settings.setting.opa[0]);
        audioSource[1].volume = float.Parse(Settings.setting.opa[0]);
    }

    public void OnIn(int index)
    {
        audioSource[1].PlayOneShot(sounds[index]);
    }
}
